package com.korovyansk.mapsproto.application;

public class MapsProtoApplication {
	public static final String TAG = "com.korovyansk.mapsproto";

	public static class PerformanceTimer{
		public PerformanceTimer(String message, boolean autoStart){
			this.message = message;
			if(autoStart)
				go();
		}
		
		public void go(){
			startTime = System.currentTimeMillis();
		}
		
		public void check(){
			long dt = System.currentTimeMillis() - startTime;
			if(dt > 500){
				android.util.Log.i("PerformanceTimer ", message + " " + dt + "ms");
			} else if (dt > 200){
				android.util.Log.d("PerformanceTimer ", message + " " + dt + "ms");
			} else{
				android.util.Log.v("PerformanceTimer ", message + " " + dt + "ms");
			}
				
		}
		
		private long startTime;
		private String message;
	}
	
	public static class Log {

		public static void v(String localTag, String message) {
			android.util.Log.v(TAG, localTag + ": " + message);
			android.util.Log.v(localTag, message);
		}
		
		public static void d(String localTag, String message) {
			android.util.Log.d(TAG, localTag + ": " + message);
			android.util.Log.d(localTag, message);
		}

		public static void i(String localTag, String message) {
			android.util.Log.i(TAG, localTag + ": " + message);
			android.util.Log.i(localTag, message);
		}

		public static void w(String localTag, String message) {
			android.util.Log.w(TAG, localTag + ": " + message);
			android.util.Log.w(localTag, message);
		}

		public static void w(String localTag, Throwable throwable) {
			android.util.Log.w(TAG, "exception in " + localTag, throwable);
			android.util.Log.w(localTag, throwable);
		}

		public static void w(String localTag, Throwable throwable, String message) {
			android.util.Log.w(TAG, localTag + ": " + message, throwable);
			android.util.Log.w(localTag, message, throwable);
		}

	}
}
